#!/bin/sh

. /etc/profile


/bin/amida-fbmesg "Booting from pendrive" "Please don't remove the pendrive"
### Start logger
#/sbin/syslogd -S -b 2

if [ ! -f /etc/pointercal ]; then
	/sbin/depmod
	/bin/ts_calibrate
fi

/bin/amida-fbmesg "Booting from pendrive" "Please don't remove the pendrive"

### Load drivers and create device nodes - Stage-1
/sbin/modprobe amida-powercontrol 

modprobe g_ether idVendor=0x049f idProduct=0x505a 
echo "m" >/etc/settings/usb.mode
echo "1" >/proc/usb_switch
ifconfig usb0 192.133.133.1 up

### Start sshd
mkdir /tmp/root
chown root.root /var/empty
/sbin/sshd

ifconfig lo up

### Start the UI
#/bin/sh /etc/amida_init_ui
/usr/local/apps/testsuite/files/periodic_sync.sh &
>/tmp/.startui

### Setup backlight and volume
echo 8 > /proc/backlight
/bin/aumix  -v  100

### Start udev
/sbin/udevd --daemon


### Create static links for device files
/bin/ln -s /dev/ttyS0 /dev/smartcard
/bin/ln -s /dev/ttyS1 /dev/printer
/bin/ln -s /dev/ttyS2 /dev/biometric

### Load drivers and create device nodes - Stage-2
/sbin/modprobe usbhid
/sbin/modprobe amida-contactless-smartcard
/sbin/modprobe amida-gps
/bin/mknod /dev/clrc632 c 100 0
/bin/mknod /dev/gps c 240 0

####Testing gps only for this pendrive
count=0
while [ -f /root/nmea$count.txt ]
	do
	count=`expr $count + 1`
	done
/bin/echo "/root/nmea$count.txt">/tmp/.gps_log
